# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=mtools
pkgver=4.0.35
pkgrel=1
epoch=1
pkgdesc="A collection of utilities to access MS-DOS disks"
arch=('x86_64')
url="https://www.gnu.org/software/mtools/"
license=('GPL3')
depends=('bash' 'glibc')
makedepends=('libx11' 'texinfo')
optdepends=('libx11: required by floppyd'
            'libxau: required by floppyd')
backup=("etc/${pkgname}.conf")
source=("https://ftp.gnu.org/gnu/mtools/${pkgname}-${pkgver}.tar.bz2"{,.sig})
sha512sums=('ef563b3319285667993c82d819e08cb819a6bcd71c466fc252568996b4218cfb3731107ffcd6150ba33c0837e012e02057def41e2b011f751eaf550bfa366a10'
            'SKIP')
b2sums=('9c1ac7f3ad3f9f13a572d0e1ea3c3a9d79bd08f0ae963c7357a19a687b74536cd8442eb167a9e50f7d22398c56736753b0d98bccdaa4c7d8427d1c09e1dd786c'
        'SKIP')
validpgpkeys=('51A23D9D7C4DF41AA48FA893E99CF5537790B839') # Alain KNAFF <alain@knaff.lu>

prepare() {
  cd "${pkgname}-${pkgver}"
  # comment entry in default config
  sed -e '/^SAMPLE FILE$/s:^:# :' -i mtools.conf
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr \
              --mandir=/usr/share/man \
              --infodir=/usr/share/info \
              --sysconfdir=/etc
  make
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -vDm 644 mtools.conf -t "${pkgdir}/etc/"
  install -vDm 644 {README,NEWS} -t "${pkgdir}/usr/share/doc/${pkgname}"
}
